package net.bolue.sysmng.tblbean;

import java.util.Iterator;
import java.util.Map;
import java.util.Set;


/**
 * 更新基本资源
 * @author Administrator
 *
 */
public class UpdRes extends TableBean{

	/**
	 * 子系统
	 */
	private String subSys;
	
	/**
	 * 更新标识
	 */
	private String updateId;
	
	/**
	 * 更新类型
	 * 1,直接数据表操作
	 * 2,数据表映射类操作
	 * 3,批量直接数据表操作
	 */
	private Integer updType;
	
	/**
	 * 描述
	 */
	private String resDesc;
	
	/**
	 * 更新对象
	 */
	private String resObj;
	
	/**
	 * 更新列
	 */
	private String updCols;
	
	/**
	 * 只显示列集
	 */
	private String dispCols;
	
	/**
	 * 排列格式
	 */
	private String arrayFmt;
	
	/**
	 * 业务类名
	 */
	private String busiClass;
	
	/**
	 * 业务方法名
	 */
	private String busiMethod;
	
	/**
	 * 备注
	 */
	private String remark;

	public String getSubSys() {
		return subSys;
	}

	public void setSubSys(String subSys) {
		this.subSys = subSys;
	}

	public String getUpdateId() {
		return updateId;
	}

	public void setUpdateId(String updateId) {
		this.updateId = updateId;
	}

	public Integer getUpdType() {
		return updType;
	}

	public void setUpdType(Integer updType) {
		this.updType = updType;
	}

	public String getResDesc() {
		return resDesc;
	}

	public void setResDesc(String resDesc) {
		this.resDesc = resDesc;
	}

	public String getResObj() {
		return resObj;
	}

	public void setResObj(String resObj) {
		this.resObj = resObj;
	}

	public String getUpdCols() {
		return updCols;
	}

	public void setUpdCols(String updCols) {
		this.updCols = updCols;
	}

	public String getDispCols() {
		return dispCols;
	}

	public void setDispCols(String dispCols) {
		this.dispCols = dispCols;
	}

	public String getArrayFmt() {
		return arrayFmt;
	}

	public void setArrayFmt(String arrayFmt) {
		this.arrayFmt = arrayFmt;
	}

	public String getBusiClass() {
		return busiClass;
	}

	public void setBusiClass(String busiClass) {
		this.busiClass = busiClass;
	}

	public String getBusiMethod() {
		return busiMethod;
	}

	public void setBusiMethod(String busiMethod) {
		this.busiMethod = busiMethod;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	@Override
	public TableBean mapToEntry(Map<String, Object> map) {
		UpdRes updRes = new UpdRes();
		Set<String> keySet = map.keySet();
		Iterator<String> keyIt = keySet.iterator();
		while(keyIt.hasNext()){
			String key = keyIt.next();
			Object o = map.get(key);
			if("SUBSYS".equals(key)){
				updRes.setSubSys((String)o);
			} else if("UPDATEID".equals(key)){
				updRes.setUpdateId((String)o);
			} else if("UPDTYPE".equals(key)){
				updRes.setUpdType((Integer)o);
			} else if("RESDESC".equals(key)){
				updRes.setResDesc((String)o);
			} else if("RESOBJ".equals(key)){
				updRes.setResObj((String)o);
			} else if("UPDCOLS".equals(key)){
				updRes.setUpdCols((String)o);
			} else if("DISPCOLS".equals(key)){
				updRes.setDispCols((String)o);
			} else if("ARRAYFMT".equals(key)){
				updRes.setArrayFmt((String)o);
			} else if("BUSICLASS".equals(key)){
				updRes.setBusiClass((String)o);
			} else if("BUSIMETHOD".equals(key)){
				updRes.setBusiMethod((String)o);
			} else if("REMARK".equals(key)){
				updRes.setRemark((String)o);
			}
		}
		return updRes;
	}

	@Override
	public String keyProps() {
		return "SUBSYS,UPDATEID";
	}
	
	public String getTableName(){
		String tableName = "";
		if(this.updType==1||this.updType==3){
			tableName = this.resObj;
		}
		return tableName;
	}
	
}
